﻿@model IPagination<OrderInfo>
@using BankCreditPortfolio.DAL.Entities
@using MvcContrib.Pagination
@using MvcContrib.UI.Grid
@using MvcContrib.UI.Pager

@{
    ViewBag.Title = "OrdersArchive";
}
<strong>Orders Archive</strong>
<p>
	Here you can see the orders that were rejected or repayed.
</p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/Styles/forms.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/Styles/customgrid.css")" rel="stylesheet" type="text/css" />

@using (Html.BeginForm())
{
    <div>
@{
    if (Model.Count() != 0)
    {
        var grid = Html.Grid(Model).Columns(column =>
        {
            column.For(x => x.Client.Profile.FirstName + " " + x.Client.Profile.LastName).Named("Client");
            column.For(x => Html.ActionLink(x.Tariff.Title, "Tariff", "Home", new { tariffId = x.Tariff.TariffId }, null)).Named("Tariff");
            column.For(x => x.Amount).Named("Amount");
            column.For(x => x.Currency.Title).Named("Currency");
            column.For(x => x.OrderStatus.Status).Named("Order Status");
            column.For(x => Html.ActionLink("Order History", "OrderHistory", new { orderId = x.OrderId, inProgressOrder=false }, null)).Named("Order History");
        });
        grid.Render();
        <br />
        @Html.Pager(Model).First("First").Last("Last").Next("Next").Previous("Previous")
    }
    else
    {
		<div>There is no orders.</div>
    }
}
    </div> 
}

